@model DNA.OpenAPI.Rss.RssChannel
@{
    Ajax.Dna().Widget()
        .UserPreferences(@<text>
    @Html.Partial("_FeedUserPreferences", item)
    </text>)
           .Content(@<text>
    @if ((bool)ViewBag.HasError)
    {
        <div class="ui-state-error" style="padding: 10px;">
           @Html.Global("RES_SUBSCRIPTION_SOURCE_INCORRECT")</div>
    }
    else
    {
        if ((Model.Items != null) && (Model.Items.Count > 0))
        {
            if (item.GetData<bool>("ShowFeedInfo"))
            {
        <table style="width: 100%;">
            <tr>
                <td>
                    @if (!string.IsNullOrEmpty(Model.Image.ImageUrl))
                    {
                        if (!string.IsNullOrEmpty(Model.Image.NavigateUrl))
                        {
                        <a href="@Model.Image.NavigateUrl" target="_blank" rel="nofollow">
                            <img src="@Model.Image.ImageUrl" alt="logo" />
                        </a>
                        }
                        else
                        {
                        <img src="@Model.Image.ImageUrl" alt="logo" />
                        }
                    }
                </td>
                <td style="text-align: top;">
                    <h2>
                        @if (!string.IsNullOrEmpty(Model.Link))
                        {
                            <a href="@Model.Link" target="_blank" rel="nofollow">@Model.Title</a>
                        }
                        else
                        {
                            @Model.Title
                        }
                    </h2>
                    @if (!string.IsNullOrEmpty(Model.Description))
                    {
                        <div>
                            @Model.Description</div>
                    }
                    @if (!string.IsNullOrEmpty(Model.Description))
                    {
                        <div>
                            @Model.Copyright
                        </div>
                    }
                </td>
            </tr>
        </table>
            }
            var _layout = "_Rss" + item.GetString("Layout");
            var viewdata = new ViewDataDictionary();
            viewdata["TextLen"] = item.UserPreferences["TextLen"];
            viewdata["ShowAuthor"] = item.UserPreferences["ShowAuthor"];
            viewdata["ShowDate"] = item.UserPreferences["ShowDate"];
            var rows = item.GetInt("Rows") > 0 ? item.GetInt("Rows") : 5;
            var feedItems = Model.Items.Count > rows ? Model.Items.Take(rows) : Model.Items;
        @Html.Partial(_layout, feedItems, viewdata)
        <div style="clear: left;">
        </div>
        }
        else
        { 
        <div class="ui-state-highlight ui-corner-all" style="padding: 15px; margin-top: 5px;">
            @Html.Global("Feed_Empty")
            @if ((HttpContext.Current.User.IsWebOwner()) && (string.IsNullOrEmpty(item.GetString("Url"))))
            {
                <div style="margin-top: 5px;">
                    Please <a href="javascript:void(0);" onclick="location=location+'?design=true&returnUrl='+location;">
                        <u>toggle</u></a> the page design mode and set the Url of feed to enable this
                    subscription.
                </div>
            }
        </div>
        }
    }
    </text>)
           .Render(); 
}
